﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Entities;
using DataAccess;

namespace InsuranceVehicle.AdminSite
{
    public partial class LoginAdmin : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            lblError.Visible = false;
            txtUsername.Focus();
        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            EmployeeDataAccess db = new EmployeeDataAccess();
            if (db.EmployeeLogin(txtUsername.Text,txtPassword.Text) != null)
            {
                Session["Employee"] = db.EmployeeLogin(txtUsername.Text, txtPassword.Text);
                Response.Redirect("ReportInsurance.aspx");
            }
            else
            {
                lblError.Visible = true;
                lblError.Text = "Your Account or password is incorrect";
            }
        }
    }
}